﻿/*  DISCLAIMER ***

    Copyright (c) 2014 Michael T. Joiner

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 
    to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  
 */

#region Using Statements

using System;

#endregion

namespace Application.SceneEditor.Data
{
    /// <summary>
    /// Class used as a base object for entities
    /// </summary>
    public abstract class Entity : BaseNotifier
    {
        #region Properties

        /// <summary>
        /// Gets or Sets a value indicating the name of this object
        /// </summary>
        public string Name
        {
            get
            {
                var value = string.Empty;

                lock (SyncContext)
                    value = m_Name;

                return value;
            }

            set
            {
                var oldValue = Name;

                lock (SyncContext)
                    m_Name = value;

                if (Name != oldValue)
                    NotifyPropertyChanged("Name");
            }
        }

        /// <summary>
        /// Gets or Sets a value describing this object
        /// </summary>
        public string Description
        {
            get
            {
                var value = string.Empty;

                lock (SyncContext)
                    value = m_Description;

                return value;
            }

            set
            {
                var oldValue = m_Description;

                lock (SyncContext)
                    m_Description = value;

                if (Description != oldValue)
                    NotifyPropertyChanged("Description");
            }
        }

        /// <summary>
        /// Gets a value indicating the 'Entity' type this object represents
        /// </summary>
        public EntityType Type { get; private set; }

        #endregion

        #region Methods

        #region Constructor

        /// <summary>
        /// Constructs a new instance of this object
        /// </summary>
        /// <param name="type">a value which indicates this type of this object</param>
        public Entity(EntityType type)
        {
            this.Name = string.Empty;
            this.Description = string.Empty;
            this.Type = type;
        }

        #endregion

        #endregion

        private string m_Name;
        private string m_Description;
        protected object BaseFRBObject;
    }
}
